package org.hank.compose_yyzs.db.converters

import androidx.room.TypeConverter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import org.hank.compose_yyzs.bean.UnUploadFile

/**
 *@auth: Hank
 *邮箱: cs16xiaoc1@163.com
 *创建时间: 2023/4/8 15:31
 *描述:
 */
object FileTypeConverter {
    @TypeConverter
    fun toList(str: String): MutableList<UnUploadFile> {
        return Gson().fromJson(str, object : TypeToken<MutableList<UnUploadFile>>() {}.type)
    }

    @TypeConverter
    fun toString(lists: MutableList<UnUploadFile>): String {
        return Gson().toJson(lists)
    }
}